package com.wangjw.test;

import java.lang.reflect.Field;

/**
 * Created by wangjw on 18/6/14.
 */
public class Person {

    public String name;

    public int age;

    public Person(String name, int age) {
        this.name = name;
        this.age = age;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public static void main(String[] args) {
        Class cls = Person.class;

        Field[] fields = cls.getFields();
        for (Field field : fields) {
            System.out.println(field.getName());
        }

        System.out.println("========");
        fields = cls.getDeclaredFields();
        for (Field field: fields) {
            System.out.println(field.getName());
        }
    }
}
